package mynet

import (
	"fmt"
	"net"
	"time"
)

func SendOne() error {

	conn, err := net.DialTimeout("tcp", "localhost:8080", 3*time.Second)
	if err != nil {
		return err
	}
	fmt.Println("client running-----")
	ws := []byte("hello")
	_, err = conn.Write(ws)
	if err != nil {
		return err
	}
	for {
		bs := make([]byte, lenthByte)
		_, err = conn.Read(bs)
		if err != nil {
			return err
		}
		if len(bs) <= 0 {
			break
		}
		fmt.Println(string(bs))
	}
	return nil
}
